INCLUDE(PythonEnvironment)
GET_PYTHON_ENV()

FILE(GLOB PYTHON_EXAMPLES *.py)
FOREACH(EXAMPLE ${PYTHON_EXAMPLES})
	STRING(REGEX REPLACE ".*/(.*).py" "\\1" EXAMPLE_NAME ${EXAMPLE})
	add_test(NAME python_modular-${EXAMPLE_NAME}
			WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
			COMMAND ${PYTHON_EXECUTABLE} ${EXAMPLE})
	set_property(TEST python_modular-${EXAMPLE_NAME} PROPERTY
				ENVIRONMENT "${PYTHON_ENV_VARS}")

ENDFOREACH()